<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns="http://www.w3.org/1999/xhtml" 
                template="./../Template/AdminTemplate.xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="content">
        <h:outputText value="#{eventControl.resetForm()}"/>
        <h:form enctype="multipart/form-data">
            <p:panel id="panel" header="Create New Event">
                <p:messages id="msgs"/>
                <h:panelGrid columns="2">

                    <h:outputLabel value="EventId:" for="eventId" />
                    <p:inputText id="eventId"  value="#{eventControl.newEvent.eventId}" title="input EventId" required="true" requiredMessage="he EventId field is required."  />



                    <h:outputLabel value="Title:" for="title" />
                    <p:inputTextarea rows="6" cols="33" value="#{eventControl.newEvent.title}" required="true" requiredMessage="The Title field is required."/>

                    <h:outputLabel value="Photo:" for="photo" />

                    <p:fileUpload mode="advanced" update="preview"  sizeLimit="1000000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" auto="true"  fileUploadListener="#{eventControl.handleFileUploadAddEvent}" />  
                    <h:outputLabel value="Avatar:" for="preview" />
                    <h:commandLink id="preview" value="" ><img src="#{eventControl.newEvent.photo}" height="100" width="70" /></h:commandLink>

                    <h:outputLabel value="StartRegDate:" for="startRegDate" />
                    <p:calendar value="#{eventControl.newEvent.startRegDate}"   />

                    <h:outputLabel value="EndRegDate:" for="endRegDate" />
                    <p:calendar value="#{eventControl.newEvent.endRegDate}" />
                    <h:outputLabel value="StartDate" for="startDate"/>
                    <p:calendar value="#{eventControl.newEvent.startDate}" />
                    <h:outputLabel value="EndDate:" for="endDate" />
                    <p:calendar value="#{eventControl.newEvent.endDate}" />
                    <h:outputLabel value="MinPlayer:" for="minPlayer" />
                    <h:inputText id="minPlayer" value="#{eventControl.newEvent.minPlayer}" title="MinPlayer" />
                    <h:outputLabel value="MaxPlayer:" for="maxPlayer" />
                    <h:inputText id="maxPlayer" value="#{eventControl.newEvent.maxPlayer}" title="MaxPlayer" />
                    <h:outputLabel value="IsActive"/>
                    <p:selectBooleanCheckbox value="#{eventControl.newEvent.isActive}" />
                    <h:outputLabel value="Description:" for="description" />
                    <p:editor value="#{eventControl.newEvent.description}"/>
                    <p:commandButton value="Create" actionListener="#{eventControl.insert()}" update="panel"/>
                    <p:commandButton value="Reset" type="reset" />
                </h:panelGrid>
            </p:panel>
        </h:form>


    </ui:define>

</ui:composition>
